package com.itshen.repository;

import com.itshen.entity.User;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.data.mongodb.repository.ReactiveMongoRepository;
import org.springframework.stereotype.Repository;
import reactor.core.publisher.Flux;

@Repository
public interface UserRepository extends ReactiveMongoRepository<User,String> {

    /**
     * 根据年龄范围查询用户
     * @param start
     * @param end
     * @return
     */
    Flux<User> findByAgeBetween(int start, int end) ;

    @Query("{'age':{'$get':20,'$let':30}}")
    Flux<User> oldUser();
}
